package cake.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cake.dao.CategoryDao;
import cake.dao.impl.CakeDaoImpl;
import cake.dao.impl.CategoryDaoImpl;
import cake.entity.Category;
@WebServlet("/index.html")
public class IndexServlet extends HttpServlet{
   @Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	   CategoryDao categoryDao=new CategoryDaoImpl();
	   List<Category> list=categoryDao.getAllCategory();
	   req.setAttribute("categories", list);
	   req.getRequestDispatcher("index.jsp").forward(req, resp);
	}
}
